package com.roadmap.client.sns;

import java.util.List;

import com.roadmap.client.module.BaseManager;
import com.roadmap.entities.Aspirant;
import com.roadmap.entities.Category;
import com.roadmap.exception.InvalidQueryException;
import com.roadmap.exception.InvalidValueException;
import com.roadmap.exception.NullObjectException;
import com.roadmap.exception.ServerException;

public class CategoryManager extends BaseManager {
	public CategoryManager(String parentId) {
		super(parentId, Category.class);
	}

	public CategoryManager(String parentId, Aspirant owner){
		super(parentId, Category.class, owner);
	}

	@Override
	public List getEntitiesOfAspirant() throws NullObjectException,
			InvalidQueryException, ServerException, InvalidValueException {
		String hql = "from Category where ownerId=?";
		return getDbUtil().executeHQLQuery(hql, new Object[]{getOwnerId()});
	}
	
	public List getCategoriesByType(String entryType) throws ServerException{
		String hql = "from Category where ownerId=? and entryType=?";
		return getDbUtil().executeHQLQuery(hql, new Object[]{getOwnerId(), entryType});
	}
}
